/*  This file is Copyright 2010 Hampton Smith
 *
 *  This file is part of Adventure! a text-adventure game engine by Hampton
 *  Smith.
 *
 *  Adventure! is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Adventure! is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Adventure!.  If not, see http://www.gnu.org/licenses/.
 */

package edu.clemson.cs.hamptos.adventure;

/**
 * <p>A <code>DoNotUnderstandException</code> is thrown by an Adventure! game
 * object (like an <code>AdventureLocation</code> or an 
 * <code>AdventureTarget</code>) when it is asked to process a command but is
 * unable to do so.  Generally, throwing such an exception will cause the
 * game engine to try and interpret the command itself or print an error message
 * to the user.</p>
 */
public class DoNotUnderstandException extends Exception {

    private final AdventureCommand myCommand;

    /**
     * <p>Creates a new <code>DoNotUnderstandException</code>, indicating that
     * the command that was not understood was <code>c</code>.</p>
     *
     * @param c The command that was not understood.
     */
    public DoNotUnderstandException(AdventureCommand c) {
        super();

        myCommand = c;
    }

    /**
     * <p>Creates a new <code>DoNotUnderstandException</code>, indicating that
     * the command that was not understood was <code>c</code> and suggesting
     * to the game engine that the given error message would be appropriate.
     * </p>
     *
     * @param c The command that was not understood.
     * @param message A suggested error message.
     */
    public DoNotUnderstandException(AdventureCommand c, String message) {
        super(message);

        myCommand = c;
    }

    /**
     * <p>Returns the <code>AdventureCommand</code> that was not understood.</p>
     *
     * @return The <code>AdventureCommand</code> that was not understood.
     */
    public AdventureCommand getCommand() {
        return myCommand;
    }
}
